<!DOCTYPE html>
<html>
<head>
	<title>查看合同</title>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="/layui-v2.3.0/layui/css/layui.css"  media="all">
	<link rel="stylesheet" type="text/css" href="css/front/myContact.css">
	<link rel="stylesheet" type="text/css" href="css/front/button.css">
	<script src="${ctxPath!}/jquery/jquery.min.js"></script>


	<script type="text/javascript">
	function closeIt() {
		var div = document.getElementById('addComment');
		div.style.display='none';
	}
</script>
<script type="text/javascript">
	function openIt(workId) {
		var div = document.getElementById('addComment');
		div.style.display="block";
		$("#workerId").val(workId);
	}
</script>

<script>
layui.use(['form','rate','layer'], function(){
		var rate = layui.rate;
		var form = layui.form;
		var layer=layui.layer;
		rate.render({
		elem: '#rate'
		,value: 0
		,half: false
		,text: true
		,choose: function(value){
			$("input[name='rate']").val(value);
		}
  })
    //监听提交
    form.on('submit(*)', function(data) {
        layer.alert(JSON.stringify(data.field), {
            title: '最终的提交信息'
        })
        $.ajax({
            type:"POST",
            url:"/front/comment",
            data:$("#commentForm").serialize(),
            success:function (data) {
                if (data.status == 200) {
                    layer.alert(data.msg, {
                        icon: 1,
                        skin: 'layer-ext-moon'
                    }, function () {
                        window.location.href = "/individualInfo.html?workerId="+$("#workerId").val();
                    });
                } else {
                    layer.alert(data.msg, {
                        icon: 2,
                        skin: 'layer-ext-moon'
                    });
                }
            }
        })
		return false;
    });
});
</script>

</head>
<body style="background-color: #DDDDDD">
	<% include("/templates/common/nav.html"){} %>

<div class="addComment" style="display: none;" id="addComment">

	<div class="close" onclick="closeIt()">
			<img src="/images/close.png" class="close-image">
	</div>

	<form id="commentForm" action="" class="layui-form" method="post">
		<input type="hidden" id="workerId" name="workerId" value=""/>
		<input type="hidden" id="userId" name="userId" value="${session.cUser.id}"/>
		<input type="hidden" name="star" value=""/>

		<div class="column" style="margin-top: 50px;">
			<label class="label">评分：</label>
			<div id="rate" name="rate" style="display: inline-block; font-size: 20px;"></div>
		</div>

		<div class="column">
			<label class="label" style="position: absolute;">备注：</label>
			<textarea id="content" name="content" class="extraInfo"></textarea>
		</div>

		<div class="column">
			<button id="submit" class="button button-3d button-action button-pill" style="position: absolute; font-size: 20px; margin-left: 125px; margin-top: 375px; width: 250px;" lay-filter="*" lay-submit>确认评价</button>
		</div>
	</form>

</div>



	<div class="content">

			<%
				for(contract in contracts!){
					if(contract.status==false){
			%>
				<div class="contacted-item">
					<div class="row">
						<div class="normal" style="width: 375px; font-size: 25px;">
							<label>合同编号:${contract.id}</label>
						</div>
						<div class="finished">
							<label>已完成</label>
						</div>
					</div>
					<div class="row">
						<div class="normal">
							<label>育婴师：</label>
						</div>
						<div class="normal">
							<label>${contract.nurseryTeacherName!}</label>
						</div>
						<div class="normal">
							<label>育婴师ID：</label>
						</div>
						<div class="normal">
							<label>${contract.nurseryTeacherId}</label>
						</div>
					</div>

					<div class="row">
						<div class="normal">
							<label>育婴师等级：</label>
						</div>
						<div class="normal">
							<label>${contract.workerLevel.desc}</label>
						</div>
						<div class="normal">
							<label >育婴顾问：</label>
						</div>
						<div class="normal">
							<label>${contract.nurseryConsultantName}</label>
						</div>
					</div>

					<div class="row">
						<div class="normal">
							<label>服务开始时间：</label>
						</div>
						<div class="normal">
							<label>${contract.startDate,dateFormat="yyyy-MM-dd"}</label>
						</div>
						<div class="normal">
							<label >服务结束时间：</label>
						</div>
						<div class="normal">
							<label>${contract.endDate,dateFormat="yyyy-MM-dd"}</label>
						</div>
					</div>

					<div class="big-row">
						<div class="normal" style="position: absolute; margin-top: 20px; margin-left: 25px;">
							<label>服务内容：</label>
						</div>
						<div class="text-area" style="position: absolute; margin-top: 20px; margin-left: 230px;">
							<label></label>
						</div>
					</div>
					<div class="row">
						<div class="normal" style="margin-left: 465px;">
							<label>总金额：</label>
						</div>
						<div class="normal" style="color: #FF9900">
							<label>￥${contract.money}</label>
						</div>
					</div>

					<button class="button button-3d button-primary button-rounded" style="margin-left: 675px; margin-top: 10px;" onclick='openIt("${contract.nurseryTeacherId}")'>进行评价</button>

				</div>
			<%
					}else{
			%>
				<div class="contacting-item">
					<div class="row">
						<div class="normal" style="width: 375px; font-size: 25px;">
							<label>合同编号:${contract.id}</label>
						</div>
						<div class="running">
							<label>进行中……</label>
						</div>
					</div>
					<div class="row">
						<div class="normal">
							<label>育婴师：</label>
						</div>
						<div class="normal">
							<label>${contract.nurseryTeacherName!}</label>
						</div>
						<div class="normal">
							<label>育婴师ID：</label>
						</div>
						<div class="normal">
							<label>${contract.nurseryTeacherId!}</label>
						</div>
					</div>

					<div class="row">
						<div class="normal">
							<label>育婴师等级：</label>
						</div>
						<div class="normal">
							<label>${contract.workerLevel.desc}</label>
						</div>
						<div class="normal">
							<label >育婴顾问：</label>
						</div>
						<div class="normal">
							<label>${contract.nurseryConsultantName}</label>
						</div>
					</div>

					<div class="row">
						<div class="normal">
							<label>服务开始时间：</label>
						</div>
						<div class="normal">
							<label>${contract.startDate,dateFormat="yyyy-MM-dd"}</label>
						</div>
						<div class="normal">
							<label >服务结束时间：</label>
						</div>
						<div class="normal">
							<label>${contract.endDate,dateFormat="yyyy-MM-dd"}</label>
						</div>
					</div>

					<div class="big-row">
						<div class="normal" style="position: absolute; margin-top: 20px; margin-left: 25px;">
							<label>服务内容：</label>
						</div>
						<div class="text-area" style="position: absolute; margin-top: 20px; margin-left: 230px;">
							<label></label>
						</div>
					</div>
					<div class="row">
						<div class="normal" style="margin-left: 465px;">
							<label>总金额：</label>
						</div>
						<div class="normal" style="color: #FF9900">
							<labe>￥${contract.money!}</labe>
						</div>
					</div>

					<button class="button button-3d button-primary button-rounded" style="margin-left: 675px; margin-top: 10px;" disabled="disabled">进行评价</button>
				</div>
			<%
					}
			%>
			<%
				}elsefor{
			%>
				<div class="empty" style="display: block;">
					<img src="http://gw.alicdn.com/tfs/TB1j1v5damWBuNjy1XaXXXCbXXa-218-248.png" style="width: 150px; height: 150px; margin-top: 200px; margin-left: 350px;">
					<label class="empty-tip">合同记录还是空的，选择育婴师预定吧！</label>
				</div>

			<%
				}
			%>


	</div>

	<div style="width: 100%; margin-top: 0px; position: absolute; height: 70px; background-color: #3399FF; color: white; font-size: 15px; text-align: center;">
        <p style="font-size: 14px; margin-top: 20px;">Copyright ©2018-2019【母婴系统】 华迪有限公司 | 川ICP备号-3 | 川公网安备 11011502019527</p>
    </div>

</body>
</html>